package com.autumn.platform.dao.schema.script.original;

import java.util.List;

import org.apache.ibatis.parsing.XNode;
import org.apache.ibatis.scripting.xmltags.SqlNode;
import org.apache.ibatis.scripting.xmltags.VarDeclSqlNode;
import org.apache.ibatis.session.Configuration;

import com.autumn.platform.dao.schema.script.IScriptHandler;

public class BindScriptHandler implements IScriptHandler {

    @Override
    public void handleScriptNode(Configuration configuration, XNode node, List<SqlNode> targetContents) {
        String name = node.getStringAttribute("name");
        String expression = node.getStringAttribute("value");
        VarDeclSqlNode sqlNode = new VarDeclSqlNode(name, expression);
        targetContents.add(sqlNode);
    }
}
